<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .cards {
            display: flex;
            gap: 10px;
            /* 如果想要让右侧的padding露出来，就要把padding的右侧改为透明的border；border的
            厚度很厚
            */
            /* padding: 18px; */
            border: 18px solid transparent;
            overflow: auto;
            overscroll-behavior: contain;
            scroll-padding: 18px;
        }
        .card {
            flex: 0 0 120px;
            width: 150px;
            height: 50px;
            background-color: pink;
        }
    </style>
</head>
<body>
    <div class="cards">
        <div class="card">1</div>
        <div class="card">2</div>
        <div class="card">3</div>
        <div class="card">4</div>
    </div>    
</body>
</html>